package client;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LayoutManager;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

/**
 * E' un pannello di sfondo che contiene un'immagine animata
 */
public class PannelloAnimato extends JPanel {
	private static final long serialVersionUID = 1L;
	private ImageIcon immagine;

	public PannelloAnimato() {
		super(true);
		immagine = new ImageIcon("cascata.gif");
		setBackground(Color.BLACK);
	}

	public PannelloAnimato(LayoutManager layout) {
		super(layout);
	}

	public PannelloAnimato(boolean isDoubleBuffered) {
		super(isDoubleBuffered);
	}

	public PannelloAnimato(LayoutManager layout, boolean isDoubleBuffered) {
		super(layout, isDoubleBuffered);
	}

	protected void paintComponent(Graphics graph) {
		super.paintComponent(graph);
		Graphics2D g = (Graphics2D) graph;
		immagine.paintIcon(this, g, (getParent().getWidth()-immagine.getIconWidth())/2, (getParent().getHeight()-immagine.getIconHeight())/2);
	}

}
